<script setup lang="ts">
import { PAGINATIONFOOT } from "@/utils/staticData";
import { useRouter } from "vue-router";

defineOptions({ name: "manageTable" });
const router = useRouter();
defineProps({
  tableHeight: { default: 0, type: Number },
  tableData: { type: Array, default: () => [] },
  pagination: { type: Object, default: () => {} }
});

const handleDetail = (row: any) => {
  router.push({
    path: "/inventory/inventoryAbnormalPage",
    query: { id: row.id }
  });
};
</script>

<template>
  <el-table
    :data="tableData"
    class="tableBox"
    style="width: 100%"
    :height="
      tableHeight - (pagination.total > pagination.size ? PAGINATIONFOOT : 0)
    "
  >
    <el-table-column type="index" label="序号" min-width="80" />
    <el-table-column
      prop="stockAbnormalCode"
      label="库存异动单号"
      min-width="184px"
      show-overflow-tooltip
    />
    <el-table-column
      prop="itemNum"
      label="库存异动物料总数"
      min-width="160"
      show-overflow-tooltip
    />
    <el-table-column
      prop="num"
      label="库存异动物料总量"
      min-width="160"
      show-overflow-tooltip
    />
    <el-table-column
      prop="relateBoundCode"
      label="关联单据号"
      min-width="184"
      show-overflow-tooltip
    />
    <el-table-column
      prop="createTime"
      label="库存异动时间"
      min-width="200"
      show-overflow-tooltip
    />
    <el-table-column fixed="right" label="操作" align="left" min-width="144">
      <template #default="{ row }">
        <el-button type="primary" link @click="handleDetail(row)"
          >详情</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>
